import type { Config } from '../types/config';
const testPrefix = '//apigate-test.10jqka.com.cn/d/charge';
const releasePrefix = '//apigate.10jqka.com.cn/d/charge';

const marketCodeMap = {
  // 沪深合集16&32必须
  HS: ['16', '17', '32', '33'],
  // 新三板（151市场为北交所）
  // SB: ['144', '145', '146', '151'],
  // 全球指数(包含92市场的境外期货)
  // GZS: ['88', '89', '90', '92'],
  // 港股
  // HK: ['177', '178'],
  // 美股
  // USA: ['169', '170', '171', '185', '186'],
  // 板块
  // BK: ['48', '49'],
  // 外汇
  // WH: ['97', '98', '99', '100'],
  // 国内期货
  // QH: ['65', '66', '67', '68', '69', '70'],
  // 封闭式基金
  // FD: ['20', '36'],
  // 英伦股
  // EU: ['160', '161']
};

const apis = {
  broadcastData: '/zxapi/broadcast/v1/next',
  stockdiagnosis: '/stockdiagnosis/v1/diagnose',
  searchStock: '//ozone.10jqka.com.cn/tg_templates/doubleone/apiCenter/searchStock/index.php',
  isShow: '/zxapi/broadcast/v1/judge_show',
};

const statId = 'thspc_shoufeipd_xnr';

const test: Config = {
  statId,
  apis,
  marketCodeMap,
  // 让虚拟人阅读内容的时候需要
  userId: 'test',
  baseUrl: '//avatar-test.aicubes.cn/vtuber',
  wsBaseUrl: 'ws://172.19.80.69:8086',
};
const release: Config = {
  statId,
  apis,
  marketCodeMap,
  userId: 'b2c-high-level-paid-vtuber',
  baseUrl: '//avatar.aicubes.cn/vtuber',
  wsBaseUrl: 'wss://avatar-ws.aicubes.cn:8443',
};
const env = 'test';
const [config, prefix] = env === 'test' ? [test, testPrefix] : [release, releasePrefix];

Object.keys(config.apis).forEach(key => {
  const originUrl = config.apis[key];
  config.apis[key] = originUrl.includes('//') ? originUrl : `${prefix}${originUrl}`;
});

export default config;
